package com.comm.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import com.comm.MainApplication;


/**
 * Created by chenxunlin01 on 2017/9/20.
 */

abstract public class BaseActivity<T extends BaseController> extends AppCompatActivity {

    protected MainApplication imContext;
    protected T controller;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        imContext = (MainApplication) getApplication();
        setContentView(getContentLayout());
        init(savedInstanceState);
        controller.onCreate(getIntent());
    }

    @Override
    protected void onDestroy() {
        controller.onDestroy();
        super.onDestroy();
    }

    abstract protected void init(Bundle savedInstanceState);
    abstract protected int getContentLayout();
}
